<?php

namespace App\Http\Controllers\Wechat\User;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repos\UserRepo;
use App\Http\Requests\Api\UserRequest;

class UserController extends Controller
{
    public function info(UserRequest $request)
    {
    
    	$rs['status'] = false;
    	$where['id'] = $request->user_id;
    	$data = UserRepo::find($where);
    	if($data) {
    		$rs['status'] = true;
    		$rs['data'] = $data;
    		return response()->json($rs)->setEncodingOptions(JSON_NUMERIC_CHECK);;
    	}
    	return response()->json($rs)->setEncodingOptions(JSON_NUMERIC_CHECK);;
    }

    public function money(UserRequest $request) 
    {
        $rs['status'] = false;
        $where['user_id'] = $request->user_id;
        $where['type'] = 1;
        $data = UserRepo::getUserMoneyLog($where);
        if($data) {
            $rs['status'] = true;
            $rs['data'] = $data;
            return response()->json($rs)->setEncodingOptions(JSON_NUMERIC_CHECK);;
        }
        return response()->json($rs)->setEncodingOptions(JSON_NUMERIC_CHECK);;
    }

    
    
}
